home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / msdos / raytrace / pov / gen / prepov05 / prepov05.rea < prev   
Text File  |  1994-10-03  |  6KB  |  259 lines

  1. Short: preprocessor for POV 1.0
  2. Type: gen/pc
  3. Author: 
  4. Uploader:
  5.  
  6.  
  7. ================================================================ PREPOV 0.5
  8. Pre-Processor for PoVRay 1.0           RMB  Compuserve 73050,261
  9. ================================================================ Feb /93
  10.  
  11.                  --- F R E E W A R E ---    USE IT !!!
  12.  
  13. - Prepov is a "preprocessor", that means it need a Input File (ascii) and the
  14.   Output is another ascii file processed.
  15.  
  16. - Usage :    PREPOV05 Input Output
  17.         where Input is the file to process and Output is the file processed,
  18.         you have to enter the complete name of the file WITH EXETENSION.
  19.         The program override the Output file, if it exist, so take care.
  20.  
  21. - Ej.   PREPOV05 example.pre example.pov
  22.  
  23.  
  24. ============================== SYNTAXIS =====================================
  25.  
  26. Constants.
  27. -----------------------------------------------------------------------------
  28.  
  29.    Prepov replaces in the input file all the ocurrences between "[" and "]",
  30. with the value of the formula evaluated.
  31.  
  32. Ej.
  33.    Input
  34.        object {
  35.                sphere {< [1+1] [ 4/2] [ (2.5+1.5)/2 ]> [8/4] > }
  36.               }
  37.    Output
  38.        object {
  39.                sphere {< 2.0 2.0 2.0> 2.0 > }
  40.               }
  41.  
  42.  
  43. Var's
  44. -----------------------------------------------------------------------------
  45.  
  46.    With Preprov you can define var's and then use them in your file.
  47. The var's name are 00 to 99 and you define them with the "#" character
  48. and use them with the "@" character.
  49.  
  50. Ej.
  51.  
  52.    Input
  53.  
  54.       #01 = 1.5
  55.       #23 = 2.5
  56.  
  57.       object {
  58.                sphere {< [1+1] 2 [ (@23+@01)/2 ]> [8/4] > }
  59.              }
  60.  
  61.    Output
  62.  
  63.       // #01 = 1.5
  64.       // #23 = 2.5
  65.  
  66.       object {
  67.                sphere {< 2.0 2 2.0> 2.0 > }
  68.               }
  69.  
  70.  
  71.    You can use the var's in any order, but TAKE CARE to define only one var
  72. per line and nothing else! in that line. You can use the var's in where you
  73. want any number of times. Is posible to re-define the var's where you want.
  74. If you use a var with no definition it has the value 0.0 (cero).
  75.    REMEMBER to put the formula between  "[ ]"
  76.  
  77. Ej.
  78.  
  79. // This definition are correct !
  80.  
  81. #10 =5.23
  82.    #20 =   10.5
  83.  #00=8.3
  84.  
  85. // This definitions are INCORRECT !
  86.  
  87. #1 = 5.23
  88. #01 = 8.23  // Don't put comments in the same line!
  89. #01 = 10  #02 = 20
  90.  
  91. In the first case don't use #1 use #01, in the two others there is something
  92. else in the line.
  93.  
  94. Ej.
  95.  
  96. Input
  97.  
  98. // This is a CORRECT EXAMPLE using var's.
  99.  
  100. #01 = 10
  101. #02 = 0.500
  102. #03 = 0.75
  103.  
  104. #90 = 0.4
  105.  
  106. object {
  107.         sphere { <[@01] [@01/2] 0> [@01/5] }
  108.         texture
  109.         {
  110.          color red [@02] green [@02/2] blue 0  alpha [@03]
  111.          ambient [@90]
  112.         }
  113.        }
  114.  
  115. #01 = 20
  116. #90 = 0.6
  117.  
  118. object {
  119.         sphere { <[@01] [@01/2] 0> [@01/5] }
  120.         texture
  121.         {
  122.          color red [@02] green [@02/2] blue 0  alpha [@03]
  123.          ambient [@90]
  124.         }
  125.        }
  126.  
  127. Output
  128.  
  129. // This is a CORRECT EXAMPLE using var's.
  130.  
  131. //#01 = 10
  132. //#02 = 0.500
  133. //#03 = 0.75
  134.  
  135. //#90 = 0.4
  136.  
  137. object {
  138.         sphere { <10.0000 5.0000 0> 2.0000 }
  139.         texture
  140.         {
  141.          color red 0.5000 green 0.2500 blue 0  alpha 0.7500
  142.          ambient 0.4000
  143.         }
  144.        }
  145.  
  146. //#01 = 20
  147. //#90 = 0.6
  148.  
  149. object {
  150.         sphere { <20.0000 10.0000 0> 4.0000 }
  151.         texture
  152.         {
  153.          color red 0.5000 green 0.2500 blue 0  alpha 0.7500
  154.          ambient 0.6000
  155.         }
  156.        }
  157.  
  158.  
  159. Value format
  160. -----------------------------------------------------------------------------
  161.  
  162.    Prepov use the format (Pascal) d1:d2 when in prints a value, where d1 is
  163. the number of total digits (including the point) and d2 is the number of
  164. digits for the fractional part.
  165.                         Ej
  166.                           12.12:6:3  ==> 12.120
  167.                           0.1  :6:3  ==>  0.100
  168.  
  169.   The default value of d1 and d2 is 4, but you can change where you want
  170. defining two special var's #d1 and #d2.
  171.  
  172. Ej.
  173.  
  174. Input
  175.    sphere {<0 0 [1.18]> 1>}
  176.  
  177.    #d1 = 6
  178.    #d2 = 1
  179.  
  180.    sphere {<0 0 [1.18]> 1>}
  181.  
  182. Ouput
  183.    sphere {<0 0 1.1800> 1>}
  184.  
  185.    #d1 = 6
  186.    #d2 = 1
  187.  
  188.    sphere {<0 0    1.2> 1>}
  189.  
  190.  
  191.  
  192. Formula format
  193. -----------------------------------------------------------------------------
  194.  
  195. You can use any format number like         .1  0.1   1E-01  are all equiv.
  196. and any of these operators : + - * / ^
  197.  
  198. Example [{ (1.0+1)^3/8 } + { (3*3/9.0) }]  = 2  // You can use { and }
  199.  
  200. You can use any of this functions upercase or lowercase:
  201.  
  202.                   PI - ABS - SQRT - SQR - LN - LOG - EXP - FACT
  203.                   SINH - COSH - TANH - SECH - CSCH - COTH
  204.                   SIN - COS - TAN - SEC - CSC - COT - ASIN - ACOS - ATAN
  205.  
  206. The trigonometics functions (Sin,Cos etc..) use radians angles (Pi/2 == 90)
  207.  
  208. Examples
  209.         [Pi*1.0]   = 3.14159
  210.         [FACT(3)]  = 6.00000   // Factorial of 3 = 3! (Can't use real numbers)
  211.         [Sin(Pi/4)]= 0.7071    // Pi/4 in radians == 45 degrees
  212.  
  213.         [{ln(Sin(Pi/4))} + log(sqrt(18.34))] = 0.2851
  214.  
  215.  
  216. Errors
  217. -----------------------------------------------------------------------------
  218.  
  219.   The only errors the program detects are formula errors, when they happen
  220. the program stop with a message printing the formula, the location and the
  221. type of error.
  222.  
  223. Ej
  224.  Input
  225.    #01 = 3
  226.    sphere { <0 0 [Sin(@01*2)+1+*2]> 1}
  227.  
  228.  Ouput (screen)
  229.  
  230.    Sin(3.0000*2)+1+*2
  231.                   ^ Error #2 In Line xxxx
  232.  
  233.  
  234. Error Types
  235.  
  236.    1: Illegal character
  237.    2: Incorrect syntax
  238.    3: Illegal or missing parenthese
  239.    4: Incorrect real format
  240.    5: Illegal function
  241.    6: Result is undefined
  242.    7: Result is too large
  243.    8: Result is complex
  244.    9: Division by zero
  245.  
  246.  
  247. Others
  248. -----------------------------------------------------------------------------
  249.  
  250. I supouse this is a very useful program, if you think it needs something else
  251. like loops or if then estructure, please let me know at compuserve 73050,261
  252. or UUPC @postmaster.cement.edu.ar
  253.  
  254. Sorry for my writing I'am not so good in english.
  255.  
  256. Thank's to all the POV-Team
  257.  
  258.  
  259.